home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / Other Langs / Tickle-4.0 (tcl) / library / help / tcl / files / gets < prev    next >
Encoding:
Text File  |  1993-10-26  |  1.3 KB  |  28 lines  |  [TEXT/$Tcl]

  1.  
  2.           gets fileId ?varName?
  3.  
  4.  
  5.      DESCRIPTION
  6.           This command reads the next line  from  the  file  given  by
  7.           fileId  and  discards the terminating newline character.  If
  8.           varName is specified then the line is placed in the variable
  9.           by  that  name and the return value is a count of the number
  10.           of characters read (not including the newline).  If the  end
  11.           of the file is reached before reading any characters then -1
  12.           is returned and varName is set to an empty string.  If  var-
  13.           Name is not specified then the return value will be the line
  14.           (minus the newline character) or an empty string if the  end
  15.           of  the  file  is reached before reading any characters.  An
  16.           empty string will also be returned if  a  line  contains  no
  17.           characters except the newline, so eof may have to be used to
  18.           determine what really happened.  If the  last  character  in
  19.           the  file is not a newline character then gets behaves as if
  20.           there were an additional newline character at the end of the
  21.           file.   FileId must be stdin or the return value from a pre-
  22.           vious call to open; it must refer to a file that was  opened
  23.           for reading.
  24.  
  25.  
  26.      KEYWORDS
  27.           file, line, read
  28.